package active.interpreter;

public class ClientInterPreter {

    public static void main(String[] args) {
        Expression maleExpression = getMaleExpression();
        Expression marriedWomanExpression = getMarriedWomanExpression();

        boolean zjr_and_cxl_is_yidui = maleExpression.interpret("zsjrs and cxsls is yidui");
        boolean zyr_is_married = marriedWomanExpression.interpret("zsyr is married");
        System.out.println("zjr = " + zjr_and_cxl_is_yidui);
        System.out.println("zyr" + zyr_is_married);
    }

    private static Expression getMaleExpression() {
        TerminalExpression zjr = new TerminalExpression("zjr");
        TerminalExpression cxl = new TerminalExpression("cxl");
        return new OrExpression(zjr, cxl);
    }

    private static Expression getMarriedWomanExpression() {
        Expression zyr = new TerminalExpression("zyr");
        Expression married = new TerminalExpression("married");
        return new AndExpression(zyr, married);
    }


}
